package com.example.goods_service.controller;

import com.example.goods_service.return_data.Mall_Data;
import com.example.goods_service.service.GoodsServiceImpl_liujingxi;
import com.example.goods_service.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@Api
public class GoodsController_liujingxi {

    @Autowired
    GoodsServiceImpl_liujingxi goodsServiceImpl_liujingxi;
    Mall_Data mall_data = new Mall_Data();


    @ApiOperation("查询商品信息")
    @RequestMapping("/selectgoods")
    public Mall_Data selectgoods(@RequestParam("id")int id){
        List<T_commodity> list = goodsServiceImpl_liujingxi.selectgoods(id);
        System.out.println("goods"+list);
        return new Mall_Data(200,"",list);
    }

    @ApiOperation("查询商品图片")
    @RequestMapping("/selectpicture")
    public Mall_Data selectpicture(@RequestParam("id")int id){
        List<T_picture> list = goodsServiceImpl_liujingxi.selectpicture(id);
        System.out.println("picture"+list);
        return new Mall_Data(200,"",list);
    }

    @ApiOperation("查询商品规格详情")
    @RequestMapping("/selectattribute")
    public Mall_Data selectattribute(@RequestParam("id")int id){
        List<T_commodity_allocation> list = goodsServiceImpl_liujingxi.selectattribute(id);
        System.out.println("attribute"+list);
        return new Mall_Data(200,"",list);
    }

    @ApiOperation("查询商品规格")
    @RequestMapping("/selectconfiguration_type")
    public Mall_Data selectconfiguration_type(@RequestParam("id")int id) {
        List<T_category_config> list = goodsServiceImpl_liujingxi.selectconfiguration_type(id);
            System.out.println("configuration_type="+ list);
        return new Mall_Data(200,"",list);
    }
}
